/**
 * 
 */
package com.trendytech.tds.system.dao;

import java.util.List;

import com.trendytech.tds.entity.Role;
import com.trendytech.tds.entity.User;

import hm.base.dao.IBaseDAO;

/**
 * @author Robin
 *
 */
public interface IRoleDAO extends IBaseDAO<Role> {

	/**
	 * Select role list by resourceId
	 * @param resourceId
	 * @return
	 */
	public List<Role> getByResourceId(String resourceId);
	
	/**
	 * Select role list by resourceId
	 * @param resourceId
	 * @return
	 */
	public Role getByRoleId(String roleId);
	
	/**
	 * Select user list by roleId
	 * @param roleId
	 * @return
	 */
	public List<User> getByRoleIdForUser(String roleId);
	
	/**
	 * Select role list by userId
	 * @param userId
	 * @return
	 */
	public List<Role> getByUserId(String userId);
	
	/**
	 * Insert the relationship of role and resource
	 * @param roleId
	 * @param resourceId
	 * @return
	 */
	public int insertRoleResource(String roleId, String resourceId);
	
	/**
	 * Delete the relationship of role and resource
	 * @param roleId
	 * @param resourceId
	 * @return
	 */
	public int deleteRoleResource(String roleId, String resourceId);

	/**
	 * Delete the relationship of role and user by RoleID
	 * @param roleId
	 * @return
	 */
	public int deleteUsersRoleByRoleID(String roleId);

	/**
	 * Delete the relationship of role and resource by RoleID
	 * @param roleId
	 * @return
	 */
	public int deleteResourcesRoleByRoleID(String roleId);

	/**
	 * Select the relationship of role and resource by RoleID
	 * @param roleId
	 * @return
	 */
	public List<String> getResourcesRoleByRoleID(String roleId);
	
	/**
	 * count the relationship of role and resource
	 * @param roleId
	 * @param resourceId
	 * @return
	 */
	public int checkRoleResource(String roleId, String resourceId);
	
	/**
	 * get by name 
	 * @param name
	 * @return Role
	 */
	public Role getByName(String name);
}
